include "access_center.thrift"
include "device_manager.thrift"
include "camera_method.thrift"
include "camera_control.thrift"
include "subscribe.thrift"
include "cascade_relation.thrift"

namespace go device_manager_center



enum Method {
    ADD = 0,
    GET,
    UPDATE,
    LIST,
    DELETE,
    GET_GBID         //国标ID
    GET_ProvinceID   //省标ID
    WHERELIST        //通过查询条件获取设备列表
}


struct request {
    1:string connID
    2:string paramID
    3:i32 method
    4:bool  isOk
    5:Page page
}


struct Response {
    1:string connID
    2:string paramID
    3:i32  method
    4:bool isOK
    5:i32 err_code
    6:string err_msg
}

//分页
struct Page {
    1:i64 pagePre
    2:i64 pageNext
    3:string paramID
}

/****接入中心****/
//设备接入中心
struct reqDcc {
    1: Page page
    2: access_center.DccCenter dccCentre
}
struct respDcc {
    1: Response response
    2: list<access_center.DccCenter>  DccList
    3: access_center.DccCenter DccOne
}

/****接入方案****/
//接入方案 请求
struct reqConnSolution {
    1: Page page
    2: access_center.accessSolution Solution
}
//接入方案 响应
struct respConnectSolution {
    1: Response response
    2: list<access_center.accessSolution> solutionList
    3: access_center.accessSolution  solutionOne
}

/****设备管理****/
//设备请求
struct reqDevice{
    1: device_manager.Device devReq
    2: Page page
}

//设备响应
struct respDevice {
    1: Response response
    2: device_manager.Device  device
    3: i8 count
    4: list<device_manager.Device> listDevice
}


//媒体中心配置信息
struct MediaConfig{
    1: string McsID                   //媒体中心ID
    2: string MscPushStreamIP         //媒体推流地址
    3: i64 MscPushStreamPort          //端口
    4: string NatMscPushStreamStartIP //外网媒体推流地址
    5: i64 NatMscPushStreamStartPort  //外网端口
    6: i64 HttpPort                   //视频播放端口
}

/****设备控制****/

// 视频调阅请求
struct reqVideo {
    1:camera_method.PlayRequest PlayRequest
    2:MediaConfig media //媒体中心参数
    3:Page page
}

//响应直播视频
struct respVideo {
    1:Response response
    2:camera_method.PlayResponse PlayResponse
}

//响应历史视频
struct respHistoryVideo {
    1:Response response
    2:camera_method.PlayResponse PlayResponse
    3: list<camera_control.HistoryFile> listHistoryFile
}

/****摄像头云台控制****/

//请求摄像头云台
struct reqPTZControl {
   1:camera_method.PTZControl PTZControl
   2:camera_method.PTZPresetControl PTZPresetControl
   3:camera_method.ModifyParam ModifyParam
   4:Page page
}

//响应摄像头云台
struct respPTZControl{
    1:Response response
    2:list<camera_method.PTZPresetList> PTZPresetList
}

///****摄像头网闸****/
////网络看门人
//struct Gatekeeper {
//    1: i64 BoxId
//    2: string BoxesName
//    3: string OuterIP //外网IP
//    4: i32 OuterPort //外网Port
//    5: string DeviceID //设备ID
//    6: string  MscId //媒体ID
//    7: string ConnID //设备接入中心ID
//}
//
//struct respGatekeeper {
//    1:Response response
//    2:list<Gatekeeper> BoxesList
//}
//

/****订阅关系管理****/
//订阅
struct reqSubscribe {
    1:subscribe.subscribe subscribe
    2:Page page
    3:list<subscribe.subscribe> ListSubscribe
}
struct respSubscribe {
    1:subscribe.subscribe subscribe
    2:Response response
    3:list<subscribe.subscribe> ListSubscribe
}

/***国标级联***/
struct reqCascaderelation {
    1:cascade_relation.CascadeRelation cascadeRelation
    2:Page page
    3:list<cascade_relation.CascadeRelation> ListcascadeRelation
}

struct respCascaderelation {
    1:cascade_relation.CascadeRelation cascadeRelation
    2:Response response
    3:list<cascade_relation.CascadeRelation> ListcascadeRelations
}

//摄像头 批量调阅
struct  BatchPlayReques {
    1: list<camera_method.PlayRequest>  PlayRequestList
    2:  MediaConfig Media //媒体中心参数
}


/****地域信息管理****/
//地域列表
struct ProvinceIdentify  {
    1:i64    Id
    2:i64    Code
    3:string Name        //名称
    4:string Province    //省 2位
    5:string City        //市 2位
    6:string Area        //区 2位
    7:string Town        //城镇地区
}



//设备符号
struct  DeviceIdentify {
    1:i64     Id
    2:i64     Code
    3:string  Name          //名称
    4:string  Industry      //行业  7、8"`
    5:string  Use           //用途 9、10"`
    6:string  DeviceKind    //类型编码 11、12、13"`
    7:string  Network       //网络标识 14"`
    8:string  ParentDevice  //父级 设备 15,16,17"`
    9:string  SubDevice     //子级 设备 18,19,20"`
}


//响应地域符号列表
struct RespProvinceIdentify  {
    1:Response Response
    2: list<ProvinceIdentify> ProvinceList  //地域信息编号列表
}


//响应设备符号列表
struct RespDeviceIdentify  {
    1:Response Response
    2:list<DeviceIdentify> DeviceIdentifyList  //设备符号列表
}


//添加设备
struct AddDevice {
    1: ProvinceIdentify proIdentify //地域信息编号
    2: DeviceIdentify  devIdentify  //设备信息编号
    3: device_manager.Device devReq
}

struct AddDevResp{
    1:Response response
    2:list<device_manager.Device> ListDevice
    3:device_manager.Device parentDevice
}

struct StopPushFlow{
 1:string StreamID
 2:string DeviceID
 3:string MediaID
 4:MediaConfig mediaCfg //媒体中心参数
}

//设备管理中心
service DeviceManagerCenter {

    //摄像头 停止向媒体中心推流
    Response CameraVideoStopPushFlow(1:StopPushFlow spf)

    //摄像头视频调阅 (视频直播,...)
    respVideo CameraVideoCall( 1: camera_method.Method method 2: reqVideo  req)

    //历史视频
    respHistoryVideo HistoryVideoCall( 1: camera_method.Method method,2: reqVideo  req)

    //下载历史视频文件
    respHistoryVideo DownloadHistoryVideoFile( 1: reqVideo  req)

    //摄像头云台控制
    respPTZControl CameraPTZControl(1: camera_method.Method method,2:reqPTZControl req)

    //摄像头,登陆,注册,注销
    //摄像头控制//TODO 其他
    respVideo CameraControl( 1: camera_method.Method method,2: reqVideo  req)

    //设备连接中心管理
    respDcc AccessConnectCenter( 1: Method method,2: reqDcc  req)

    //摄像头接入方案
    respConnectSolution ConnectSolution( 1: Method method,2: reqConnSolution  req)

    //设备管理
    respDevice  DeviceManager (1: Method method,2:reqDevice req)

    //添加NVR设备  自动生成子设备 (NVR 接口数量 决定子设备生成数量)
    AddDevResp AddNVRDevice(1:AddDevice AddDev)

    //添加移动视频设备 (前摄像头,后摄像头, 只有一个摄像头)
    AddDevResp AddMobileDevice(1:AddDevice AddDev)


     //获取地域符号 //获取地域列表 (国标ID/省标ID)
     RespProvinceIdentify  ProvinceIDSymbols (1:Method method,2:ProvinceIdentify  provinceCode)
     //获取设备符号 (国标ID/省标ID)
     RespDeviceIdentify  DeviceIDSymbols (1:Method method,2:DeviceIdentify deviceIdentify)


    //订阅事件关系管理
    respSubscribe SubscribeCenter(1: Method method,2:reqSubscribe req)

    //国标级联关系管理
    respCascaderelation CascadeRelationCenter(1:Method method,2:reqCascaderelation req)
    //TODO 系统
}